package com.whfc.ms.api.emp.service.impl;

import com.whfc.common.exception.BizException;
import com.whfc.common.result.ListData;
import com.whfc.common.result.PageData;
import com.whfc.common.result.ResultEnum;
import com.whfc.emp.dto.AppFenceDTO;
import com.whfc.emp.dto.AppFenceEmpDTO;
import com.whfc.emp.param.AppFenceAddParam;
import com.whfc.emp.param.AppFenceEmpAddParam;
import com.whfc.emp.param.AppFenceEmpDelParam;
import com.whfc.emp.param.AppFenceListParam;
import com.whfc.emp.service.AppEmpHealthReportService;
import com.whfc.emp.service.AppFenceService;
import com.whfc.ms.api.emp.service.MsAppFenceService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @ClasssName MsAppFenceServiceImpl
 * @Description 智能安全帽-电子围栏
 * @Author hw
 * @Date 2020/12/24 16:40
 * @Version 1.0
 */
@Service
public class MsAppFenceServiceImpl implements MsAppFenceService {

    @DubboReference(interfaceClass = AppFenceService.class, version = "1.0.0", timeout = 10 * 1000)
    private AppFenceService appFenceService;

    @Override
    public ListData<AppFenceDTO> list(AppFenceListParam request) {
        List<AppFenceDTO> list = appFenceService.list(request);
        return new ListData<>(list);
    }

    @Override
    public Integer add(AppFenceAddParam request) {
        return appFenceService.add(request);
    }

    @Override
    public void del(Integer id) {
        appFenceService.del(id);
    }

    @Override
    public PageData<AppFenceEmpDTO> empList(Integer fenceId, Integer pageNum, Integer pageSize, Integer groupId, Integer workTypeId, String keyword) {
        return appFenceService.empList(fenceId, pageNum, pageSize, groupId, workTypeId, keyword);
    }

    @Override
    public void addEmp(AppFenceEmpAddParam request) {
        appFenceService.addEmp(request);
    }

    @Override
    public void delEmp(AppFenceEmpDelParam request) {
        appFenceService.delEmp(request);
    }

    @Override
    public ListData<AppFenceDTO> listByEmpId(Integer empId) {
        List<AppFenceDTO> list = appFenceService.listByEmpId(empId);
        return new ListData<>(list);
    }

    @Override
    public PageData<AppFenceEmpDTO> unGrantList(Integer deptId, Integer fenceId, Integer pageNum, Integer pageSize, Integer groupId, String keyword) {
        return appFenceService.unGrantList(deptId, fenceId, pageNum, pageSize, groupId, keyword);
    }

    @Override
    public List<AppFenceDTO> listByMsAppFence(Integer id) {
        return appFenceService.listByMsAppFence(id);
    }
}